<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="'height:' + gaodu + 'px;line-height:' + gaodu + 'px;top:' + gaodutops + 'px;'">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo"><image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image></view>
					<view class="index_wenben">{{ $t('page_luxianxinxi.route_details') }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="jiyunxinxi_center">
				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item1_t1">{{ $t('page_luxianxinxi.shipping_information') }}</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.line_name') }}</view>
						<view class="jiyunxinxi_item1_t3">{{ xiangqingdetails.name }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.billing_mode') }}</view>
						<view class="jiyunxinxi_item1_t3">{{ modelname[xiangqingdetails.free_mode - 1] }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.age_delivery') }}</view>
						<view class="jiyunxinxi_item1_t3">{{ xiangqingdetails.limitationofdelivery }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.anticipated_tariff') }}</view>
						<view class="jiyunxinxi_item1_t4">{{ price_mode.unit }}{{ xiangqingdetails.tariff ? xiangqingdetails.tariff : 0 }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.aalueAdded_service_fee') }}</view>
						<view class="jiyunxinxi_item1_t4">{{ xiangqingdetails.service_route ? xiangqingdetails.service_route : 0 }}</view>
					</view>
				</view>

				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item1_t1">{{ $t('page_luxianxinxi.billing_standard') }}</view>
					<view
						class="jiyunxinxi_item2_dis"
						v-if="xiangqingdetails.free_mode == 1 || xiangqingdetails.free_mode == 4"
						v-for="(item, index) in xiangqingdetails.free_rule"
						:key="index"
					>
						<view class="jiyunxinxi_item1_t2">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="jiyunxinxi_item1_t5">{{ price_mode.unit }}{{ item.weight_price }}/{{ xiangqingdetails.line_type_unit_name }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis" v-if="xiangqingdetails.free_mode == 3" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="jiyunxinxi_item1_t2">{{ item.weight[0] }}{{ item.weight[1] ? '-' + item.weight[1] : '' }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="jiyunxinxi_item1_t5">{{ price_mode.unit }}{{ item.weight_price }}</view>
					</view>
					<view class="jiyunxinxi_item2_dis" v-if="xiangqingdetails.free_mode == 2" v-for="(item, index) in xiangqingdetails.free_rule" :key="index">
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.head_weight') }}{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="jiyunxinxi_item1_t5">{{ price_mode.unit }}{{ item.first_price }}/{{ item.first_weight }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="jiyunxinxi_item1_t2">{{ $t('page_luxianxinxi.reweight') }}{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</view>
						<view class="jiyunxinxi_item1_t5">{{ price_mode.unit }}{{ item.next_price }}/{{ item.next_weight }}{{ xiangqingdetails.line_type_unit_name }}</view>
					</view>
					<!-- <view class="jiyunxinxi_item1_t1" style="margin-top: 26rpx">渠道增值服务</view> -->
				</view>
				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item1_t1">{{ $t('page_luxianxinxi.lineCharacteristics') }}</view>
					<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.line_special ? xiangqingdetails.line_special : '' }}</view>
				</view>
				<view class="jiyunxinxi_item1">
					<view class="jiyunxinxi_item3_dis">
						<view class="jiyunxinxi_item1_t1">{{ $t('page_luxianxinxi.article_restriction') }}</view>
						<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.goods_limit }}</view>
					</view>
					<view class="jiyunxinxi_item3_dis">
						<view class="jiyunxinxi_item1_t1">{{ $t('page_luxianxinxi.weight_limit') }}</view>
						<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.weight_limit }}</view>
					</view>
					<view class="jiyunxinxi_item3_dis">
						<view class="jiyunxinxi_item1_t1">{{ $t('page_luxianxinxi.length_limitation') }}</view>
						<view class="jiyunxinxi_item1_t2">{{ xiangqingdetails.length_limit }}</view>
					</view>
				</view>
				<view class="jiyunxinxi_item1" v-if="line_content">
					<view class="jiyunxinxi_item1_t1" style="padding-bottom: 20px">{{ $t('page_luxianxinxi.more_rules') }}</view>
					<rich-text :nodes="line_content ? line_content : ''"></rich-text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
// pages/shouye/shouye_zkc/shouye_zkc.js
const app = getApp();

let request = require('../../../utils/require');

export default {
	data() {
		return {
			navH: app.globalData.navHeight,
			gaodu: app.globalData.height,
			gaodutops: app.globalData.top,
			imgUrl: app.globalData.imgUrl,
			modelname: [this.$t('page_other.阶梯计费'),this.$t('page_other.首续重计费'), this.$t('page_other.范围区间计费'),this.$t('page_other.重量区间计费')],
			weight_mode: uni.getStorageSync('weight_mode'),
			price_mode: uni.getStorageSync('price_mode'),
			xiangqingdetails: {
				name: '',
				free_mode: '',
				limitationofdelivery: '',
				free_rule: [],
				services_require: false,
				service_route: '',
				weight_limit: '',
				length_limit: '',
				line_content: ''
			},
			line_content:'',	
			ids: ''
		};
	},
	/**
	 * 生命周期函数--监听页面加载
	 */ onLoad(options) {
		var that = this;
		that.ids = options.id
	},
	onShow() {
		var that = this;
		that.xiangqing();
	},
	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function() {},
	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function() {},
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function() {},
	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function() {},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function() {},
	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function() {
		var thisUserInfo = uni.getStorageSync('userInfo');
		var sett =  uni.getStorageSync('setting');
		var shareObj = {
			title: sett.name,
			desc: sett.desc,
			// 默认是小程序的名称(可以写SOGO express集运等)
			path: '/pages/indexs/luxianxinxi/luxianxinxi?scene=uid%3A' + thisUserInfo.user_id,
			// 默认是当前页面，必须是以‘/’开头的完整路径
			imageUrl: '',
			//自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
			success: function(res) {
				// 转发成功之后的回调
				if (res.errMsg == 'shareAppMessage:ok') {
				}
			},
			fail: function() {
				// 转发失败之后的回调
				if (res.errMsg == 'shareAppMessage:fail cancel') {
					// 用户取消转发
				} else {
					if (res.errMsg == 'shareAppMessage:fail') {
					}
				}
			}
		};
		return shareObj;
	},
	methods: {
		jumpzuo() {
			uni.navigateBack();
		},

		xiangqing() {
			var that = this;
			var data = {
				id: that.ids
			};
			request.get(`index.php?s=/api/page/lineDetails&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
				if (res.data.code == 1) {
					that.xiangqingdetails = res.data.data,
					that.line_content = res.data.data.line_content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
					
				}
				console.log(this.line_content, 77777);
			});
		}
	}
};
</script>
<style>
@import './luxianxinxi.css';
</style>
